// 枚举
import {z} from "zod";

const enumSchema = z.enum(["Red",'Yellow','Green']);
const colorValue = 'Red';
try {
    const result = enumSchema.parse(colorValue)
    console.log(result);
}catch (err){
}

const colorListSchema = z.array(enumSchema);
const colorListValue = ['Red','Green','Yellow','Yellow2'];
try {
    const result = colorListSchema.parse(colorListValue)
    console.log(result);
}catch (err){
}